package org.tong.account.jpa;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @author
 * @date 2022-12-22 9:14
 */
@LocalTCC
public interface AccountTccDaoI {

    @TwoPhaseBusinessAction(name = "accountAddAmountAction", commitMethod = "commitTcc", rollbackMethod = "cancelTcc")
    boolean prepare(BusinessActionContext businessActionContext, @BusinessActionContextParameter(paramName = "id") Long id,
                    @BusinessActionContextParameter(paramName = "amount") Long amount);

    boolean commitTcc(BusinessActionContext businessActionContext);


    boolean cancelTcc(BusinessActionContext businessActionContext);
}
